package net.zabuchy.activities.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.*;

import net.zabuchy.issue.entity.Issue;

@Entity
@Table(name="HISTORY_EVENT", catalog="quickstart")
public class History_event implements Serializable {
	
	private static final long serialVersionUID = 1L;

	private int historyEventId;
	private String summary;
	private String description;
	private String type;
	private String executor;
	private Issue issue;
	private Set<HistoryAttribute> historyAttributes = new HashSet<HistoryAttribute>(0);
	
	
    public History_event() {
    }
    
    public History_event(
    		String summary,
    		String description,
    		Set<HistoryAttribute> historyAttributes) {
    	this.summary = summary;
    	this.description = description;
    	this.historyAttributes = historyAttributes;
    }
    
    @Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="HISTORY_EVENT_ID", unique=true, nullable=false)
    public int getHistoryEventId() {
		return historyEventId;
	}

	public void setHistoryEventId(int historyEventId) {
		this.historyEventId = historyEventId;
	}

	@Column(name="SUMMARY", nullable=false)
	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	@Column(name="DESCRIPTION", nullable=false)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name="TYPE")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name="EXECUTOR")
	public String getExecutor() {
		return executor;
	}

	public void setExecutor(String executor) {
		this.executor = executor;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ISSUE_ID", nullable = false)
	public Issue getIssue() {
		return issue;
	}

	public void setIssue(Issue issue) {
		this.issue = issue;
	}

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "historyEvent", cascade = CascadeType.ALL)
	public Set<HistoryAttribute> getHistoryAttributes() {
		return historyAttributes;
	}
	
	public void setHistoryAttributes(Set<HistoryAttribute> historyAttributes) {
		this.historyAttributes = historyAttributes;
	}

    
}